package com.automation.ljf.strategy.impl;

import com.automation.ljf.domain.dataobject.CaseStepDO;
import com.automation.ljf.strategy.OperationStrategy;
import com.automation.ljf.util.ResultMessage;
import org.openqa.selenium.chrome.ChromeDriver;
import org.springframework.stereotype.Component;

/**
 * 跳出iframe或frame表单
 *
 * @author lijiefeng
 * @since 2021/8/31
 */
@Component("ESC_IFRAME")
public class EscFrameStrategyImpl implements OperationStrategy {

    @Override
    public ResultMessage doOperation(ChromeDriver driver, CaseStepDO caseStepDO, String jsonData) {
        String windowHandle = driver.getWindowHandle();
        driver.switchTo().defaultContent();
        return ResultMessage.ok("操作成功").addData("window", windowHandle);
    }

}
